<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;

class MailController extends commencontroller
{
    //
    function send(){
 /*       if ($input=Input::all){

                $name=$input['toname'];
            $to=$input['toemail'];
                $flag=Mail::send('emails.email',['name'=>$name,'to'=>$to],function ($message){

                    $message->to($to)->subject('测试邮件');

                    $attachment=storage_path('app\files\test.doc');
                    $message->attach($attachment,['as'=>"=?utf-8?B".base64_encode('测试文档')."?=.doc"]);

                });
                if(!$flag){
                    echo '发送成功';
                }else{
                    echo '发送失败';
                }




        }else{
            return view('test');
        }*/



       /* $image = Storage::get('image\ok.jpg');*/
        /*dd($image);*/
        $name='烟染虚城醉若沙√';
        $flag=Mail::send('emails.email',['name'=>$name/*,'image'=>$image*/],function ($message){
            $to='1608303629@qq.com';
            $message->to($to)->subject('测试邮件');

            $attachment=storage_path('app\files\test.doc');

            $message->attach($attachment,['as'=>"=?utf-8?B".base64_encode('测试文档')."?=.doc"]);

        });
        if(!$flag){
            echo '发送成功';
        }else{
            echo '发送失败';
        }

    }
    function email(){

    }
    public function cate(){
        echo '123';
    }
}
